package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealMapper {
    Page<SetmealVO> page(SetmealPageQueryDTO setmealPageQueryDTO);

    @AutoFill(OperationType.INSERT)
    void add(Setmeal setmeal);

    @Select("SELECT * FROM setmeal WHERE id = #{id}")
    SetmealVO getById(Long id);

    @Select("SELECT * FROM setmeal WHERE id = #{id}")
    Setmeal get(Long id);

    void deleteBatch(List<Long> ids);

    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    List<Setmeal> list(Setmeal setmeal);

    @Select("SELECT COUNT(*) FROM setmeal WHERE status = #{status}")
    Integer countSetmeals(Integer status);
}
